import { getConfig } from "@/ultils/configHelper";
import { supabase } from "@/ultils/supabase";
import { updateUser } from "./ApiAuth";

const supabaseUrl = getConfig("SUPABASE_URL");
const tokenName = getConfig("SUPABASE_AUTH_TOKEN");
const userData = JSON.parse(localStorage.getItem(tokenName)); //把字符串json转成对象
// Upload file using standard upload
export async function uploadAvatar(avatarFile, newAvatarName) {
  const { error } = await supabase.storage
    .from("avatar")
    .upload(`public/${newAvatarName}`, avatarFile, {
      cacheControl: "3600",
      upsert: false,
    });
  if (error) {
    console.log(error.message);
    return;
  }
}
